#include "token.hpp"

const std::string TOKEN_TYPE_NAMES[] = {
    "NUMBER",
    "WORD",

    "PLUS",
    "MINUS",
    "STAR",
    "SLASH",

    "LPAR",
    "RPAR",

    "EQU",

    "RETURN",
    "TYPEDEF",

    "END_OF_FILE"
};

Token::Token(TokenType type, std::string value) {
    this->type = type;
    this->value = value;
}

Token::Token(TokenType type) {
    this->type = type;
    this->value = "";
}

TokenType Token::get_type() {
    return this->type;
}

std::string Token::get_value() {
    return this->value;
}

std::string Token::str() {
    if (this->value == "") return TOKEN_TYPE_NAMES[this->type];
    return TOKEN_TYPE_NAMES[this->type] + ':' + this->value;
}
